package com.ddogring.business.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ddogring.business.domain.Order;
import com.ddogring.business.mapper.OrderMapper;
import com.ddogring.business.service.IOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * @BelongsProject: eshop
 * @BelongsPackage: com.ddogring.business.service.impl
 * @Author: DdogRing
 * @CreateTime: 2023-01-30  11:24
 * @Description: TODO
 * @Version: 1.0
 */
@Service
public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements IOrderService {

    @Autowired
    private OrderMapper orderMapper;

    /**
     * @description: 买家订单列表
     * @author: DdogRing
     * @date: 2023/1/31 16:58
     * @param: [order]
     * @return: java.util.List<com.ddogring.business.domain.Order>
     **/
    @Override
    public List<Order> selectBuyersList(Order order) {
        return orderMapper.selectBuyersList(order);
    }

    /**
     * @description:  卖家订单列表
     * @author: DdogRing
     * @date: 2023/1/31 17:14
     * @param: [order]
     * @return: java.util.List<com.ddogring.business.domain.Order>
     **/
    @Override
    public Page<Order> selectSellerList(Page<Order> page,  Order order) {
        return orderMapper.selectSellerList(page, order);
    }

    /**
     * @description: 查询用户购买清单
     * @author: DdogRing
     * @date: 2023/2/8 09:43
     * @param: [userId]
     * @return: java.util.List<com.ddogring.business.domain.Order>
     **/
    @Override
    public List<Order> selectOrderListByUserId(Long userId) {
        return orderMapper.selectOrderListByUserId(userId);
    }

    /**
     * @description: 每月分析
     * @author: DdogRing
     * @date: 2023/2/22 11:17
     * @param: []
     * @return: java.util.List<java.util.Map<java.lang.String,java.lang.Object>>
     **/
    @Override
    public List<Map<String, Object>> monthlyAnalysis(Long userId) {
        return orderMapper.monthlyAnalysis(userId);
    }

    /**
     * @description: 当月销量分析
     * @author: DdogRing
     * @date: 2023/2/22 11:17
     * @param: []
     * @return: java.util.List<java.util.Map<java.lang.String,java.lang.Object>>
     **/
    @Override
    public List<Map<String, Object>> analysisOfSalesVolumeForTheMonth(Long userId) {
        return orderMapper.analysisOfSalesVolumeForTheMonth(userId);
    }

    /**
     * @description: 当月交易额&销售额
     * @author: DdogRing
     * @date: 2023/2/22 11:22
     * @param: [userId]
     * @return: java.util.List<java.util.Map<java.lang.String,java.lang.Object>>
     **/
    @Override
    public List<Map<String, Object>> tradingAndSelling(Long userId) {
        return orderMapper.tradingAndSelling(userId);
    }
}
